home *** CD-ROM | disk | FTP | other *** search
- %OP%VS4.12 (10-Feb-92), Gerald Fitton, R4000 2915 6625 6368
- %OP%TNN
- %OP%DP4
- %OP%IRN
- %OP%PL0
- %OP%HM0
- %OP%FM0
- %OP%BM0
- %OP%LM4
- %OP%PT0
- %OP%WC2,1728,1072,1748,0,52,0,48
- %CO:A,150,0%Custom function sheet
-
- Statistics
- © G A Nicholas February 1992
-
-
- Parameters for functions
-
- sciform(number,no of significant figures)
- mean_stdev_number(range)
- sem(range)
- one_tailed_z_to_p(z)
- one_tailed_p_to_z(p)
- one_tailed_t_to_p(t,no of degrees of freedom)
- one_tailed_p_to_t(p,no of degrees of freedom)
- confidence_limits(range,probability)
- t_test(range,population mean)
- paired_t_test(range1,range2,population mean of differences)
- f_test(range1,range2)
- pooled_t_test(range1,range2)
- linear_regression_y_on_x(y_range,x_range)
-
-
- Function definitions
-
- %V%%L%function("sciform","x:number","n:number")
- %V%%L%if(@x=0)
- %V%%L% result(string(@x,@n-1))
- %V%%L%elseif(@x>0)
- %V%%L% if(log(@x)-int(log(@x))>=0)
- %V%%L% result(join(string(10^(log(@x)-int(log(@x))),@n-1),"e",string(int(log(@x)),0)))
- %V%%L% else
- %V%%L% result(join(string(10^(log(@x)-int(log(@x))+1),@n-1),"e",string(int(log(@x))-1,0)))
- %V%%L% endif
- %V%%L%else
- %V%%L% if(log(-@x)-int(log(-@x))>=0)
- %V%%L% result(join("-",string(10^(log(-@x)-int(log(-@x))),@n-1),"e",string(int(log(-@x)),0)))
- %V%%L% else
- %V%%L% result(join("-",string(10^(log(-@x)-int(log(-@x))+1),@n-1),"e",string(int(log(-@x))-1,0)))
- %V%%L% endif
- %V%%L%endif
-
-
- %V%%L%function("mean_stdev_number","range:array")
- %V%%L%avg(@range)
- %V%%L%sciform(A45,5)
- %V%%L%std(@range)
- %V%%L%sciform(A47,5)
- %V%%L%string(count(@range),0)
- %V%%L%join("mean = ",A46," ; standard deviation = ",A48," ; n = ",A49)
- %V%%L%result(A50)
-
-
- %V%%L%function("sem","range:array")
- %V%%L%std(@range)/sqr(count(@range))
- %V%%L%sciform(A55,5)
- %V%%L%join("sem = ",A56)
- %V%%L%result(A57)
-
-
- %V%%L%function("one_tailed_z_to_p","z:number")
- %V%%L%abs(@z)
- %V%%L%1+A62*(0.049867347+A62*(0.0211410061+A62*(0.0032776263+A62*(3.80036e-5+A62*(4.88906e-5+A62*5.383e-6)))))
- %V%%L%0.5/A63^16
- %V%%L%sgn(@z)*(A64-0.5)+0.5
- %V%%L%result(A65)
-
-
- %V%%L%function("one_tailed_p_to_z","prob:number")
- %V%%L%0.5-sgn(0.5-@prob)*(0.5-@prob)
- %V%%L%sqr(-2*ln(A70))
- %V%%L%A71-(2.30753+0.27061*A71)/(1+A71*(0.99229+0.04481*A71))
- %V%%L%A72*sgn(0.5-@prob)
- %V%%L%result(A73)
-
-
- %V%%L%function("one_tailed_t_to_p","t:number","df:number")
- %V%%L%if(abs(@t)<3,@t,@t*(1+0.037*ln(abs(@t))^2.5/(2*@df-1)))
- %V%%L%sgn(A78)*(8*@df+1)*sqr(@df*ln(1+A78*A78/@df))/(8*@df+3)
- %V%%L%one_tailed_z_to_p(A79)
- %V%%L%result(A80)
-
-
- %V%%L%function("one_tailed_p_to_t","prob:number","df:number")
- %V%%L%one_tailed_p_to_z(@prob)
- %V%%L%sgn(A85)*sqr(@df*(exp((A85*(8*@df+3)/(8*@df+1))^2/@df)-1))
- %V%%L%if(abs(A86)<3)
- %V%%L% result(A86)
- %V%%L%else
- %V%%L% A86/(1+0.05*ln(abs(A86))^2/(2*@df-1))
- %V%%L%endif
- %V%%L%result(A90)
-
-
- %V%%L%function("confidence_limits","range:array","prob:number")
- %V%%L%count(@range)-1
- %V%%L%string(A96,0)
- %V%%L%avg(@range)
- %V%%L%sciform(A98,5)
- %V%%L%std(@range)/sqr(count(@range))
- %V%%L%(100-@prob)/200
- %V%%L%one_tailed_p_to_t(A101,A96)
- %V%%L%sciform(A102*A100,5)
- %V%%L%join(string(@prob,1),"%PC% confidence limits = ",A99," ± ",A103," ; degrees of freedom = ",A97)
- %V%%L%result(A104)
-
-
- %V%%L%function("t_test","range:array","mu:number")
- %V%%L%abs(avg(@range)-@mu)/(std(@range)/sqr(count(@range)))
- %V%%L%sciform(A109,5)
- %V%%L%join("t = ",A110," ; ","degrees of freedom = ",string(count(@range)-1,0))
- %V%%L%result(A111)
-
-
- %V%%L%function("paired_t_test","range_1:array","range_2:array","mu:number")
- %V%%L%count(@range_1)
- %V%%L%@range_1-@range_2
- %V%%L%abs(avg(A117))
- %V%%L%std(A117)
- %V%%L%A119/sqr(A116)
- %V%%L%(A118-@mu)/A120
- %V%%L%join("mean difference = ",sciform(A118,5)," ; t = ",sciform(A121,5)," ; degrees of freedom = ",string(A116-1,0))
- %V%%L%result(A122)
-
-
- %V%%L%function("F_test","range_1:array","range_2:array")
- %V%%L%string(count(@range_1)-1,0)
- %V%%L%std(@range_1)
- %V%%L%string(count(@range_2)-1,0)
- %V%%L%std(@range_2)
- %V%%L%if(A128>=A130,join(A127,",",A129),join(A129,",",A127))
- %V%%L%if(A128>=A130,(A128/A130)^2,(A130/A128)^2)
- %V%%L%join("s1 = ",sciform(A128,5)," (",A127,") ; s2 = ",sciform(A130,5)," (",A129,") ; F(",A131,") = ",sciform(A132,5))
- %V%%L%result(A133)
-
-
- %V%%L%function("pooled_t_test","range_1:array","range_2:array")
- %V%%L%count(@range_1)
- %V%%L%avg(@range_1)
- %V%%L%std(@range_1)
- %V%%L%count(@range_2)
- %V%%L%avg(@range_2)
- %V%%L%std(@range_2)
- %V%%L%sqr(((A138-1)*A140^2+(A141-1)*A143^2)/(A138+A141-2))
- %V%%L%sciform(abs((A139-A142)/(A144*sqr(1/A138+1/A141))),5)
- %V%%L%join("mean1 = ",sciform(A139,5)," ; mean2 = ",sciform(A142,5)," ; t = ",A145," ; degrees of freedom = ",string(A138+A141-2,0))
- %V%%L%result(A146)
-
-
- %V%%L%function("linear_regression_y_on_x","range_y:array","range_x:array")
- %V%%L%index(linest(@range_y,@range_x),2,1)
- %V%%L%sciform(A151,5)
- %V%%L%index(linest(@range_y,@range_x),1,1)
- %V%%L%sciform(A153,5)
- %V%%L%(count(@range_x)*sum(@range_x*@range_y)-sum(@range_x)*sum(@range_y))/(count(@range_x)*(count(@range_x)-1)*std(@range_x)*std(@range_y))
- %V%%L%string(A155,4)
- %V%%L%join("gradient = ",A152," ; y_intercept = ",A154," ; corr coeff = ",A156)
- %V%%L%result(A157)
-